package com.cx.service.admin.basic.impl;

import com.cx.dao.impl.ChainJKTDaoSupport;
import com.cx.service.admin.basic.ChainBasicPrivilegeManager;
import org.cx.entity.Page;
import org.cx.entity.PageData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service("chainBasicPrivilegeService")
public class ChainBasicPrivilegeService implements ChainBasicPrivilegeManager {

    @Resource(name = "chainJKTDaoSupport")
    private ChainJKTDaoSupport chainJKTDao;


    @Override
    public List<PageData> findPrivilegeDetailPage(Page pg) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("PrivilegeMapper.findPrivilegeDetailPage", pg);
        return list;
    }

    @Override
    public List<PageData> findPrivilegeByPageDate(PageData pd) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("PrivilegeMapper.findPrivilegeByPageDate", pd);
        return list;
    }

    @Override
    public PageData selectPrivilegeByID(PageData pd) {
        pd = (PageData) chainJKTDao.findForObject("PrivilegeMapper.selectPrivilegeByID", pd);
        return pd;
    }

    @Override
    public Integer insertPrivilege(PageData pd) {
        Integer result  =(Integer) chainJKTDao.save("PrivilegeMapper.insertPrivilege",pd);
        return result;
    }

    @Override
    public Integer updatePrivilege(PageData pd) {
        Integer result =(Integer) chainJKTDao.update("PrivilegeMapper.updatePrivilege",pd);
        return result;
    }

    @Override
    public List<PageData> findPrivilegeDetailByRootId(PageData pd) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("PrivilegeMapper.findPrivilegeDetailByRootId", pd);
        return list;
    }

    @Override
    public PageData findPrivilegeDetailByName(PageData pd) {
        PageData obj = (PageData) chainJKTDao.findForObject("PrivilegeMapper.findPrivilegeDetailByName", pd);
        return obj;
    }
}
